<?php
	header("Expires: Thu, 17 May 2001 10:17:17 GMT");    // Date in the past
	header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
	header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
	header ("Pragma: no-cache");                          // HTTP/1.0
	include 'connect.php';
	session_start();

	if (!isset($_SESSION['SESSION'])) require ( "session_init.php");
	
	if ($_SESSION['LOGGEDIN'] != true) {
			header("Location: signin.php");
			exit;
	}	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tinkenawo: Home</title>

<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
<link href="STYLE1.CSS" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
</head>

<body>

<div class="container">
 <div id="wrapper">
<div id="content">
    <div class="header"><a href="#"><img src="images/tinke.jpg" alt="Insert Logo Here" name="Insert_logo" width="100%" height="167" id="Insert_logo" style="background-color: #8090AB; display:block;" /></a> 
    <!-- end .header --></div>
	<div id="menu">
		
        <ul id="MenuBar1" class="MenuBarHorizontal">
          <li><a class="item" href="index.php">Home</a></li>          
          <li><a href="signin.php" class="item">Local Lifts</a> </li>
          <li>  <a href="signin.php" class="item">Inter-District Lifts</a></li>        
          <li><a href="signin.php" class="item">Forum</a></li>
          <li><a href="signin.php
" class="item">How it Works</a></li>
        </ul>
	</div>
  <div class="sidebar1">
    <?php include'quicklinks.php'; ?>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p><!-- end .sidebar1 --></p>
  </div>
  <div class="content"><?php include'signedin_userbar.php';?>
 
  <h3 class="title"> <center>
     <p class="color"><font color="#3CF"> Latest Lifts</font></p>
   </center>
   </h3>
 <div id="TabbedPanels1" class="TabbedPanels">
   <ul class="TabbedPanelsTabGroup">
     <li class="TabbedPanelsTab" tabindex="0">Lift Offers</li>
     <li class="TabbedPanelsTab" tabindex="0">Lift Requests</li>
   </ul>
   <div class="TabbedPanelsContentGroup">
     <div class="TabbedPanelsContent">
       <?php
	// connect to database
	include 'connect.php';

	// retrieve data
	
/*	$sql2="SELECT COUNT(`user_id`)  FROM `lift_offers`";
	if($sql2<1){
		echo 'No posts yet';
	mysql_close();
	}
	else
	{*/
		$sql1="SELECT * FROM `lift_offers` LIMIT 4";
		$result = mysql_query($sql1);
	// print table header
		echo " <table border='0' cellspacing='0' cellpadding='0' >";
        echo " <tr bgcolor='#CCCCCC'>
          <td width='115'  ><p align='center'><em>Post by</em></p></td>
          <td width='97' ><p align='center'><em>From</em></p></td>
          <td width='97' ><p align='center'><em>To</em></p></td>
          <td width='197' ><p align='center'><em>Departing From</em></p></td>
          <td width='145' ><p align='center'><em>Time</em></p></td>
          <td width='150' ><p align='center'><em>Date</em></p></td>
          <td width='197' ><p align='center'><em>Number of Passengers</em></p></td>
         </tr>";

// print a table row for each student retrieved
$rowno = 0;
while($row = mysql_fetch_array($result))
  {
      $rowno = $rowno + 1;
      
      // get student data
	   $postby = $row['lift_by'];
	  $dtofpst = $row['lift_postdate'];
      $from = $row['lift_depdst'];
      $to = $row['lift_destdst'];
      $depplc = $row['lift_depplc'];
	$time = $row['lift_hrofdep'].':'.$row['lift_minofdep'].''.$row['lift_depam'];
	$date = $row['lift_dyofdep'].'/'.$row['lift_monofdep'].'/'.$row['lift_yrofdep'];
	$capacity = $row['lift_numbofpsgr'];
      // print odd rows with bgcolor #6699cc 
      // print even rows with bgcolor #ffffff
      if ($rowno % 2 == 1)
      {
          print "<tr>
		 		 <td bgcolor='#ccc'><p align 'center'>$postby.'<br />'.$dtofpst</p></td>
                 
                 <td bgcolor='#ccc'><p align 'center'> $from</p></td>
                 <td bgcolor='#ccc'><p align 'center'> $to</p></td>
				  <td bgcolor='#ccc'><p align 'center'> $depplc</p></td>
                 <td bgcolor='#ccc'><p align 'center'>$time</p></td>
				  <td bgcolor='#ccc'><p align 'center'>$date</p></td>
                 <td bgcolor='#ccc'><p align 'center'>$capacity</p></td>
                 </tr>";
      }
      else
      {
          print "<tr>
		  		<td bgcolor='#fff'><p align 'center'>$postby.'<br />'.$dtofpst</p></td>
                
                 <td bgcolor='#fff'><p align 'center'> $from</p></td>
                 <td bgcolor='#fff'><p align 'center'> $to</p></td>
				  <td bgcolor='#fff'><p align 'center'> $depplc</p></td>
                 <td bgcolor='#fff'><p align 'center'>$time</p></td>
				  <td bgcolor='#fff'><p align 'center'>$date</p></td>
                 <td bgcolor='#fff'><p align 'center'>$capacity</p></td>
                 </tr>";
      }

  }

// print closing tag for table
print "</table>";


// close database connection
mysql_close();
//}
	
?>
     </div>
     <div class="TabbedPanelsContent">
         <?php
	// connect to database
	include 'connect.php';

	// retrieve data
	$sql2="SELECT COUNT(*) FROM `lift_offers`";
	if($sql2<1){
		echo 'No posts yet';
		mysql_close();
	}else{
	$sql1="SELECT * FROM `lift_requests`";	
	$result = mysql_query($sql1);

	// print table header
	echo " <table border='0' cellspacing='0' cellpadding='0' >";
        echo " <tr bgcolor='#CCCCCC'>
          <td width='115' ><p align='center'><em>Post by</em></p></td>
          <td width='97' ><p align='center'><em>From</em></p></td>
          <td width='97' ><p align='center'><em>To</em></p></td>
          <td width='197' ><p align='center'><em>Departing From</em></p></td>
          <td width='145' ><p align='center'><em>Time</em></p></td>
          <td width='150' ><p align='center'><em>Date</em></p></td>
          <td width='197' ><p align='center'><em>Capacity</em></p></td>
         </tr>";

// print a table row for each student retrieved
$rowno = 0;
while($row = mysql_fetch_array($result))
  {
      $rowno = $rowno + 1;
      
      // get student data
	   $postby = $row['post_by'];
	  $dtofpst = $row['dateofpost'];
      $from = $row['depdst'];
      $to = $row['destdst'];
      $depplc = $row['depplc'];
	$time = $row['deptm'];
	$date = $row['depdate'];
	$capacity = $row[''];
      // print odd rows with bgcolor #6699cc 
      // print even rows with bgcolor #ffffff
      if ($rowno % 2 == 1)
      {
          print "<tr>
		 		 <td bgcolor='#ccc'>$postby.''.$dtofps</td>
                 
                 <td bgcolor='#ccc'> $from</td>
                 <td bgcolor='#ccc'> $to</td>
				  <td bgcolor='#ccc'> $depplc</td>
                 <td bgcolor='#ccc'>$time</td>
				  <td bgcolor='#ccc'>$date</td>
                 <td bgcolor='#ccc'>$capacity</td>
                 </tr>";
      }
      else
      {
          print "<tr>
		  		<td bgcolor='#fff'>$postby.''.$dtofpst</td>
                 
                 <td bgcolor='#fff'> $from</td>
                 <td bgcolor='#fff'> $to</td>
				  <td bgcolor='#fff'> $depplc</td>
                 <td bgcolor='#fff'>$time</td>
				  <td bgcolor='#fff'>$date</td>
                 <td bgcolor='#fff'>$capacity</td>
                 </tr>";
      }

  }

// print closing tag for table
print "</table>";


// close database connection
mysql_close();
}
?>
     </div>
  
 </div>&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;<a href="#">2</a>&nbsp;&nbsp;<a href="#">3</a>&nbsp;&nbsp;<a href="#">4</a>&nbsp;&nbsp;<a href="#">5</a>&nbsp;&nbsp;<a href="#">6</a>&nbsp;&nbsp;<a href="#">Next</a>
  </div><!-- content -->
  </div><!-- wrapper -->
    <!-- end .content --></div>
  <div class="sidebar2">
    <?php include 'quicksearch.php'; ?>
       
       <p>&nbsp;</p>
    
   &nbsp;
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<!-- end .sidebar2 --> 
 	 </div>  
  <div class="footer">
    Tinkenawo 2013
    <!-- end .footer --></div>
  <!-- end .container --></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
</script>
</body>
</html>
